<?php

namespace App\Requests;

use Framework\BaseRequest;

class QiNiuRequest extends BaseRequest
{


    /**
     * @return string[]|void
     */
    public function rules()
    {
        switch($this->route()->getActionMethod()) {
            case 'appToken':
                return [
                    'appId'=> 'required|string',
                    'roomName'=> 'required|string',
                    'userId'=> 'required|string',
                    'expireAt'=> 'required|string',
                    'permission'=> 'required|string',
                ];
                break;
            case 'createApp':
                return [
                    'title'=> 'required|string',
                    'maxUsers'=> 'required|int',
                ];
                break;
            case 'listUser':
                return [
                    'appId'=> 'required|string',
                    'roomName'=> 'required|string',
                ];
                break;
            case 'imRegister':
                return [
                    'username'=> 'required|string',
                ];
                break;
            case 'getImuserToken':
                return [
                    'user_id'=> 'required|string',
                ];
                break;
            case 'getImUserProfile':
                return [
                    'user_id'=> 'required|string',
                ];
                break;
            case 'listActiveRooms':
                return [
                    'app_id'=> 'required|string',
                ];
                break;
        }
    }


    /**
     * @return string[]
     */
    public function messages()
    {
        return [
            'appId.required' => 'appId不能为空',
            'appId.string' => 'appId必须是字符串',
            'roomName.required' => '房间名称不能为空',
            'userId.required' => '用户ID不能为空',
            'expireAt.required' => '过期时间不能为空',
            'permission.required' => '该用户的房间管理权限不能为空',
            'title.required' => '房间名称',
            'maxUsers.required' => '房间最大人数',
        ];
    }
}
